home *** CD-ROM | disk | FTP | other *** search
/ Network Supervisor's Toolkit / Network Supervisor's Toolkit.iso / menus / marxmenu / quick.mnu < prev    next >
Text File  |  1996-07-10  |  9KB  |  404 lines

  1. Comment
  2. ==========================================================
  3.  
  4. Copyright 1990-91 by Marc Perkel * All right reserved.
  5.  
  6. This file is a quick menu system for you to get going with MarxMenu
  7. quickly and esilly. It is written not only to be useful to us but to be
  8. an example of what can be done with MarxMenu.
  9.  
  10. To add a choice to a menu simply use the AddChoice command
  11. then add the appropiate Onkey statement.
  12. The menu will make the size adjustments accordinaly.
  13.  
  14.   Example:
  15.       AddChoice("Print Console",10)
  16.       ...
  17.       ...
  18.       OnKey Task(10)
  19.         PConsole
  20.       ...
  21.  
  22. If you want to change the menu's center, pass the XY
  23. coordinates to menu's CenterStretchBox procedure.
  24.  
  25.    Example:
  26.       CenterStretchBox("Menu Header",10,10)
  27.  
  28. This will cause the menu to center at Col 10, Row 10
  29.  
  30. To control custom features, edit CUSTOM.INC and other INCLUDE Files.
  31.  
  32. =========================================================
  33. EndComment
  34.  
  35. Var
  36.   FilePicked
  37.  
  38. ;----- Personalize Your Screen Messages
  39.  
  40. StatusLineText = '*-<< Acme Manufacturing Company >>-*'
  41. MenuTitle = "Joe Blow's Master Menu"
  42.  
  43. Comment
  44. =================================
  45.  
  46. In order to add menu choices conditionally you would append the
  47. choices to the end of the array after all the default choices
  48. are set. For Example:
  49.  
  50.    if DayOfWeek = Fri
  51.       AddChoice("Payroll Menu",10)
  52.    endif
  53.  
  54. Here is where menus are created.
  55.  
  56. =================================
  57. EndComment
  58.  
  59. ;----- Menu look and feel include files
  60.  
  61. Include 'CUSTOM.INC'
  62.  
  63. Comment
  64. ==========================================================
  65.  
  66. I have defined a couple of procedures called CenterStretchBox
  67. CornerStretchBox which takes as parameters a menu title, array of
  68. choices, and the XY coordinants of the center of the window. It then
  69. displays all the choices and numbers them. This method allows you to
  70. update the menu more quickly.
  71.  
  72. ==========================================================
  73. EndComment
  74.  
  75. ;----- Main Menu
  76.  
  77. AddChoice('Accounting',1)
  78. AddChoice('Word Processing',2)
  79. AddChoice('SpreadSheet',3)
  80. AddChoice('DataBase',4)
  81. AddChoice('Graphics',5)
  82. AddChoice('Communication',6)
  83. AddChoice('Publishing',7)
  84. AddChoice('Utilities',8)
  85.  
  86. CornerStretchBox ('Main Menu',11,6)
  87.  
  88. OnKey Task(1)
  89.    |Error('Put Code for Accounting here.')
  90.  
  91. OnKey Task(2)
  92.    |Error('Put Code for Word Processing here.')
  93.  
  94. OnKey Task(3)
  95.    |Error('Put Code for SpreadSheet here.')
  96.  
  97. OnKey Task(4)
  98.    |Error('Put Code for DataBase here.')
  99.  
  100. OnKey Task(5)
  101.    |Error('Put Code for Graphics here.')
  102.  
  103. OnKey Task(6)
  104.    |Error('Put Code for Communication here.')
  105.  
  106. OnKey Task(7)
  107.    |Error('Put Code for Publishing here.')
  108.  
  109. OnKey Task(8)
  110.    ^Util
  111.  
  112. OnKey Esc
  113.    |LeaveMenu
  114.  
  115. ;----- Util Menu
  116.  
  117. :Util
  118.  
  119. AddChoice('Format Disk Menu',1)
  120. AddChoice('Dos Menu',2)
  121. AddChoice('Dos Command Line',3)
  122. AddChoice('Menu Utilities',4)
  123.  
  124. CornerStretchBox ('Utility Menu',43,6)
  125.  
  126. OnKey Task(1)
  127.   |SelectFormat
  128.   |LastKey = ' '
  129.  
  130. OnKey Task(2)
  131.   ^Dos
  132.  
  133. OnKey Task(3)
  134.   |if ExistOnPath('DOLIST.EXE') > ''
  135.      DropTo DoList
  136.   |else
  137.   |  Bat 'DropTo ' + ReadEnv('COMSPEC')
  138.   |endif
  139.  
  140. OnKey Task(4)
  141.   ^MenuUtil
  142.  
  143. ;----- Dos Menu
  144.  
  145. :Dos
  146.  
  147. AddChoice('Directory Master',1)
  148. AddChoice('Pick Directory',2)
  149. AddChoice('Memory Map',3)
  150. AddChoice('Free Space',4)
  151. AddChoice('Device Drivers',5)
  152. AddChoice('Show Directory',6)
  153. AddChoice('Backup Hard Disk',7)
  154. AddChoice('Run a Program',8)
  155.  
  156. CenterStretchBox ('DOS Menu',38,15)
  157.  
  158. OnKey Task(1)
  159.   |if ExistOnPath('DM3.EXE') > ''
  160.      DropTo DM3
  161.   |else
  162.      DropTo DM
  163.   |endif
  164.  
  165. OnKey Task(2)
  166.    PD
  167.  
  168. OnKey Task(3)
  169.    RamMap
  170.    Pause
  171.  
  172. OnKey Task(4)
  173.    Free
  174.    Pause
  175.  
  176. OnKey Task(5)
  177.    Device
  178.    Pause
  179.  
  180. OnKey Task(6)
  181.    D/W
  182.  
  183. OnKey Task(7)
  184.    CD\
  185.    BACKUP C: A: /S
  186.    |Bat 'CD ' + Path
  187.  
  188. OnKey Task(8)
  189.    |FilePicked = ProgType
  190.    |if FilePicked > ''
  191.    |   FilePicked = PickAFile(FilePicked,FilePicked + ' Files')
  192.    |   if FilePicked > ''
  193.    |      Bat FilePicked
  194.    |   endif
  195.    |endif
  196.  
  197. ;----- Menu Utilities
  198.  
  199. :MenuUtil
  200.  
  201. AddChoice('Edit this Menu',1)
  202. AddChoice('View Include Files',2)
  203. AddChoice('Edit Include Files',3)
  204. AddChoice('Veiw a Menu File',4)
  205. AddChoice('Edit a Menu File',5)
  206. AddChoice('Run a Menu',6)
  207. AddChoice('Load MarxHelp',7)
  208. AddChoice('UnLoad MarxHelp',8)
  209.  
  210. CenterStretchBox ('Menu Utilities',38,15)
  211.  
  212. OnKey Task(1)
  213.    ME %MenuFileName
  214.  
  215. OnKey Task(2)
  216.    |FilePicked = PickAFile('*.INC','Include Files')
  217.    |ViewFile(FilePicked)
  218.  
  219. OnKey Task(3)
  220.    |FilePicked = GetIncludeFile
  221.    |if FilePicked > ''
  222.    |   Bat 'ME ' + FilePicked
  223.    |endif
  224.  
  225. OnKey Task(4)
  226.    |FilePicked = PickAFile ('*.MNU','Menus')
  227.    |ViewFile(FilePicked)
  228.  
  229. OnKey Task(5)
  230.    |FilePicked = PickAFile ('*.MNU','Menus')
  231.    |if FilePicked > ''
  232.    |   Bat 'ME ' + FilePicked
  233.    |endif
  234.  
  235. OnKey Task(6)
  236.    |FilePicked = PickAFile ('*.MNU','Menus')
  237.    |if FilePicked > ''
  238.    |   Bat 'MARX ' + FilePicked
  239.    |endif
  240.  
  241. OnKey Task(7)
  242.    |MxCmd = 'MarxHelp'
  243.  
  244. OnKey Task(8)
  245.    |MxCmd = 'MarxHelp /U'
  246.  
  247. ;----- This routines selects floppy disk format
  248.  
  249. Procedure SelectFormat
  250. var Ch Message Option
  251.  
  252.    DrawTheBox(20,12,42,4 + HeightDifference,'Format Floppy Disk Menu')
  253.  
  254.    Writeln ' 1 - Format 360    5 - Format /S 360'
  255.    Writeln ' 2 - Format 1.2M   6 - Format /S 1.2M'
  256.    Writeln ' 3 - Format 720    7 - Format /S 720'
  257.    Write   ' 4 - Format 1.4M   8 - Format /S 1.4M'
  258.  
  259.    Ch = ReadKey
  260.  
  261.    if Ch = '1'
  262.       Message = '360k Format with no System Files.'
  263.       Option = '/4'
  264.  
  265.    elseif Ch = '2'
  266.       Message = '1.2m Format with no System Files.'
  267.       Option = ''
  268.  
  269.    elseif Ch = '3'
  270.       Message = '720k Format with no System Files.'
  271.       Option = '/N:9/T:80'
  272.  
  273.    elseif Ch = '4'
  274.       Message = '1.4m Format with no System Files.'
  275.       Option = '/N:18/T:80'
  276.  
  277.    elseif Ch = '5'
  278.       Message = '360k Format with System Files.'
  279.       Option = '/4/S'
  280.  
  281.    elseif Ch = '6'
  282.       Message = '1.2m Format with System Files.'
  283.       Option = '/S'
  284.  
  285.    elseif Ch = '7'
  286.       Message = '720k Format with System Files.'
  287.       Option = '/N:9/T:80/S'
  288.  
  289.    elseif Ch = '8'
  290.       Message = '1.4m Format with System Files.'
  291.       Option = '/N:18/T:80/S'
  292.  
  293.    else
  294.       Return
  295.  
  296.    endif
  297.  
  298.    if DosVersionString >= '5.00'
  299.       Option = Option + '/U'     ;unconditional
  300.       Option = Option + '/V:DOS' ;automatically adds volume label
  301.    endif
  302.  
  303.    DrawTheBox(46,18,11,2 + HeightDifference,'Drive')
  304.    Writeln '  A:'
  305.    Write   '  B:'
  306.    Ch = ReadKey
  307.    if Ch = Esc then Return
  308.    ExecFormat(Ch,Option,Message)
  309. EndProc
  310.  
  311. ;----- Execute FORMAT in a DOS Window
  312.  
  313. Procedure ExecFormat (Drv,Option,Message)
  314. var FormatProg
  315.  
  316.    FormatProg = ExistOnPath('FORMAT.EXE')
  317.    if FormatProg = '' then FormatProg = ExistOnPath('FORMAT.COM')
  318.    if FormatProg = ''
  319.       Error('FORMAT program not Found!')
  320.       Return
  321.    endif
  322.  
  323.    BoxHeader = ' Formatting Drive ' + Drv + ': ' + Message + ' '
  324.    Shadow Off
  325.    DrawBox 1 4 80 21
  326.    Window  4 5 74 19
  327.    TextColor MenuHeaderFG MenuBG
  328.    Cursor Off
  329.    DosWindow
  330.    Writeln
  331.    Execute FormatProg + ' ' + Drv + ': ' + Option
  332.    EraseTopWindow
  333. EndProc
  334.  
  335. ;----- Choose Program Type
  336.  
  337. Procedure ProgType
  338.  
  339.    AddChoice('COM File')
  340.    AddChoice('EXE File')
  341.    AddChoice('BAT File')
  342.  
  343.    CornerStretchBox ('Program Type',19,16)
  344.  
  345.    OnScreenOnly On
  346.    LastKey = ReadKey
  347.  
  348.    if LastKey = 'A' then Return '*.COM'
  349.    if LastKey = 'B' then Return '*.EXE'
  350.    if LastKey = 'C' then Return '*.BAT'
  351.    if LastKey = Esc then Return ''
  352.  
  353. EndProc
  354.  
  355. ;----- Select Include File
  356.  
  357. Procedure GetIncludeFile
  358. var IncPath
  359.    IncPath = PathPart(ExistOnPath('CUSTOM.INC'))
  360.    IncPath = PickAFile(CleanFileName(IncPath + '\*.INC'),'Include Files')
  361.    if IncPath = '' then Return ''
  362.    DelFile(ForceExtension(%MenuFileName,'MRX'))
  363.    Return IncPath
  364. EndProc
  365.  
  366. ;----- View a File
  367.  
  368. Procedure ViewFile (Name)
  369.    if Name = '' then Return
  370.    BoxHeader = ' Viewing ' + Name + ' '
  371.    Shadow Off
  372.    DrawBox 1 4 80 21
  373.    TextColor MenuHeaderFG MenuBG
  374.    ViewTextFile Name
  375. EndProc
  376.  
  377. Procedure PickAFile (Mask,Message)
  378. var Files Choice MaxSize
  379.    ReadDirectory(Mask,Files)
  380.    MaxSize = Min(15,NumberOfElements(Files))
  381.    if MaxSize = 0
  382.       Error('No Choices!')
  383.       Return ''
  384.    endif
  385.    DrawTheBox(46,12 - (MaxSize / 2),20,MaxSize + HeightDifference,Message)
  386.    Choice = PickOne(Files)
  387.    Return Choice
  388. EndProc
  389.  
  390. ;----- Display Error and Wait for a Key
  391.  
  392. Procedure Error (Err)
  393. var Ch
  394.    BoxHeader = ' Error * Press any Key '
  395.    DrawBox 11 19 Max(27,length(Err) + 4) 3
  396.    Cursor Off
  397.    UseArrows Off
  398.    TextColor MenuHeaderFG MenuBG
  399.    WriteCenter Err
  400.    Write Char(7)
  401.    Ch = ReadKey
  402.    EraseTopWindow
  403. EndProc
  404.